<?php

class p_apply extends page_controllor 
{
    public function __construct($get_param)
    {
        $this->__need_login = false;
        parent::__construct($get_param);
    }
    
    public function run()
    {
        $e = $this->get_input(0);
        
        $oArraytree = new lib_arraytree(array());
        $oArraytree->restart(k::config('product_class'));
        $namefield = $this->__isLangEng ? 'eng_name' : 'name';
        $data['product_class'] = $oArraytree->get_id2field( $namefield );
        
        $oSess = K::session();
        $oSess->get('history' , $h);
        
        //最新商品
        $oProduct = K::load_mod('product');
        $oProduct->list_new_product(2);
        $aProduct = $oProduct->get_data();
        
        if(count($aProduct) > 0)
        {
            foreach ($aProduct as $k => $row)
            {
                $aProduct[$k]['name'] = $this->__isLangEng ? K_str::un_html($row['eng_name']) : K_str::un_html($row['name']);
                $aProduct[$k]['cover_url'] = product2coverpath($row['id'] , true);
                $aProduct[$k]['product_url'] = $this->login ? '/product/show/'.$row['sn'] : '/login';
            }
        }
        
        //通知
        $data['notice'] = $this->load_notice();
        $data['e'] = $e;
        $data['products'] = $aProduct;
        $this->set_page_title($this->__lang['gTitle_p_apply'].'_'.$this->__lang['gTitle_page_title']);
        $this->output('apply',$data);
        
    }
}
?>